import axios from './axios';

const projectUrl = 'project'; // 个人求职意向

export default {
  // 创建项目经验
  postProject(obj) {
    const postObj = {
      projectName: obj.projectName,
      projectDuty: obj.projectDuty,
      projectIntro: obj.projectIntro,
      isOnline: obj.isOnline,
      link: obj.link,
      startTime: Math.round((new Date(obj.startsStopTime[0]).getTime()) / 1000),
      endTime: Math.round((new Date(obj.startsStopTime[1]).getTime()) / 1000),
    };
    return axios.post(`${projectUrl}`, postObj);
  },
  // 编辑项目经验
  putProject(obj) {
    const postObj = {
      id: obj.id,
      projectName: obj.projectName,
      projectDuty: obj.projectDuty,
      projectIntro: obj.projectIntro,
      isOnline: obj.isOnline,
      link: obj.link,
      startTime: Math.round((new Date(obj.startsStopTime[0]).getTime()) / 1000),
      endTime: Math.round((new Date(obj.startsStopTime[1]).getTime()) / 1000),
    };
    return axios.put(`${projectUrl}`, postObj);
  },
  // // 项目经验列表
  getProjectList() {
    return axios.get(`${projectUrl}`);
  },
  // // 删除项目经验
  delProject(id) {
    return axios.delete(`${projectUrl}?id=${id}`);
  },
};
